Learning Objectives
After completing this lesson, you'll be able to:
- Create a Geometry parameter to take spatial input from an App.
- Implement the Geometry parameter in a self-serve data download workflow.
- Use a Geometry parameter as an end-user on FME Flow.
In this lesson, you will:
- Optional: Watch a demonstration video (if you have not attended the live training).
- Scroll down to read the activity instructions below and follow the steps in your lab.
- Complete the quiz at the end of this lesson.
- Click 'Next' to mark the lesson complete.
Learning Objectives
After completing this lesson, you'll be able to:
- Create a Geometry parameter to take spatial input from an App.
- Implement the Geometry parameter in a self-serve data download workflow.
- Use a Geometry parameter as an end-user on FME Flow.
In this lesson, you will:
- Optional: Watch a demonstration video (if you have not attended the live training).
- Scroll down to read the activity instructions below and follow the steps in your lab.
- Complete the quiz at the end of this lesson.
- Click 'Next' to mark the lesson complete.
Resources
- Starting workspace | C:\FMEData\Workspaces\CreateDataIntegrationApps\TransitDataDistribution.fmw
- Complete workspace | C:\FMEData\Workspaces\CreateDataIntegrationApps\TransitDataDistribution-complete.fmw
Input Geometry to Workspaces
From a workspace app interface, users can input geometry into workspaces for processing using parameters. Users can upload datasets through a File/Folder/URL parameter that the workspace processes, or you can configure a spatial parameter to accept input in GeoJSON or XML format.
With a File/Folder/URL parameter, your workspace must use a Reader or FeatureReader to read the input data before transforming it. In most scenarios, you will clip, join, or merge another dataset to the user's data.


For more training on inputting source datasets to workspaces through parameters, please see the Input Source Data at Runtime lesson in Manage FME Flow Data and Connections.
If you have the user input geometry through a spatial Define Geometry parameter, the easiest method to transform the GeoJSON or XML into a geometric feature is to use a GeometryReplacer.


For more training on creating the Define Geometry parameter to use on FME Flow, please see the Get Geometry Input from Users lesson in Build Self-Serve Workflows with Parameters.
Define Geometry Parameter Interactive Web Map
When you run a workspace with a Define Geometry parameter, the parameter enables an interactive web map in FME Flow that lets you draw a point, line, or area of interest to input into the workspace. The map icon next to the parameter opens the interactive web map.

From the web map, you can only input the geometry types set up in the user parameter in the workspace, which you select from the top, then draw or choose the location on the map.

You may collapse the pop-up map by clicking
and expand the menu in the inline map
for the option to pop it out into its own window.


For more information on the Define Geometry parameter and setting custom basemaps for the web map in FME Flow, please see Using the Geometry Parameter.
Exercise

Jennifer, a GIS Specialist, wants to give transit data to colleagues who only ever need one neighborhood at a time. Her workspace already lets the app user pick layers, an output format, and a coordinate system, but it always returns the whole city. She needs a spatial geometry parameter that lets the app user draw the area they need data for.
In this exercise, you will:
- Create a Define Geometry user parameter and link it to a GeometryReplacer.
- Test the workspace, publish it, and build an app that clips output to an area the user draws.
1) Open the Starting Workspace
The workspace begins by creating geometry and reprojecting it. The FeatureReader reads in the transit data from Transit.gdb, then a Clipper clips it to the input geometry. If the output format is OGC KML, the workspace styles each feature type before writing it to the file.

2) Inspect the Existing Parameters
- In the Navigator, right-click User Parameters and select Manage User Parameters.
- The workspace already has three user parameters: the layers to download from the transit data, the output data format, and the output coordinate system.

3) Create the Geometry Parameter
- Click the green + icon and select Spatial to Define Geometry.
- Configure the following parameters:
- Parameter Identifier:
GEOM
- Label:
Area of Interest
- Required: Selected
- Show Label: Selected
- Visibility: Always Show
- Geometry Encoding: GeoJSON
- Geometry Types: Polygon, Box
- Specify initial bounds for map display: Selected
- Top:
49.2548
- Left:
-123.244
- Bottom:
49.3034
- Right:
-123.071
- These bounds frame Vancouver, BC, which is where the transit data is.
- Value Assignment > Hide Parameter Menu Button: Selected

- On the left panel, reorder the parameters so Area of Interest is second, after Layers to Download.
- Click OK to close the User Parameter Manager.
4) Link the Geometry Parameter
- Double-click the GeometryReplacer transformer.
- From the Geometry Source drop-down, select the GEOM parameter under User Parameters.

5) Run the Workspace
- Click Run in the top toolbar.
- FME prompts you to configure the four user parameters.
- For Layers to Download, select one or multiple layers.
- For the Area of Interest, paste the following JSON into the parameter:
{"type":"Polygon","coordinates":[[[-123.116202,49.275826],[-123.116202,49.280585],[-123.10479,49.280585],[-123.10479,49.275826],[-123.116202,49.275826]]]}
- Set the Output Format to Esri Shapefile, and Output Coordinate System to WGS84 Lat/Longs [LL-WGS84].
- Deselect the Save As Parameter Default Values option, then click Run.
- This leaves the default parameter values blank for the end user in the app.

- Optional: Inspect the output in C:\FMEData\Output and confirm the correct layers were written in the correct format.
6) Publish to FME Flow
- Publish the workspace as TransitDataDistribution.fmw to the Training repository.
- Register it with the Data Download, Data Streaming, and Job Submitter services.
Publish to FME Flow
After you build your workflows in FME Workbench, transfer them to FME Flow through the publishing process. To publish a workspace to FME Flow, complete all steps in the publishing wizard.
1. Click Publish in the FME Flow Connection toolbar. The publishing wizard window will open.
2. Confirm your FME Flow Connection lists the correct connection and successfully connects to your FME Flow.
3. Select a repository to house the workspace on FME Flow from the drop-down options. To create a new repository, click New and enter its details.
4. Optionally, you may Upload data files to publish the workspace's source data files to FME Flow along with the workspace. You can control which files to upload from the Select Files... option.
5. Click Next to move on to the next step.
6. If your workspace uses any connections, the Upload Connections section will appear. You can select whether to publish the connections to FME Flow.
7. Register Services is the last publishing step. Select the transformation services you want your workspace to be able to use on FME Flow.
8. Click Publish.
9. The translation log generates a summary of publishing and provides a direct link to open the workspace on FME Flow.
7) Create the Workspace App
- Navigate to FME Flow.
- Open Flow Apps, select the Workspace Apps tab, and click Create.
- Enter a Name, a Title, and a Description, then configure the following parameters:
- Repository: Training
- Workspace: TransitDataDistribution.fmw
- Service: Data Download

- Expand Parameter Defaults and confirm all four parameters are listed, including the new Area of Interest parameter.
- Leave all other settings at their default value and click Create.


8) Run the Workspace App
- Click View App to open it.
- Select the transit layers you want to download.
- Click the map icon to open the Area of Interest interactive web map.

- Click the rectangle or polygon icon, then click on the map to draw the area, then click Confirm.
- FME adds the geometry area as GeoJSON to the parameter input.

- Select an Output Format and Output Coordinate System, then click Run.

- Click the Data Download URL to download the data.

- Use FME Data Inspector to confirm the data covers only the area you drew, in the layers and coordinate system you chose.

You have successfully built another self-serve web app, adding the ability to clip output data to a specific area of interest by linking user-input geometry to the workspace.
Resources
- Starting workspace | C:\FMEData\Workspaces\CreateDataIntegrationApps\TransitDataDistribution.fmw
- Complete workspace | C:\FMEData\Workspaces\CreateDataIntegrationApps\TransitDataDistribution-complete.fmw
Input Geometry to Workspaces
From a workspace app interface, users can input geometry into workspaces for processing using parameters. Users can upload datasets through a File/Folder/URL parameter that the workspace processes, or you can configure a spatial parameter to accept input in GeoJSON or XML format.
With a File/Folder/URL parameter, your workspace must use a Reader or FeatureReader to read the input data before transforming it. In most scenarios, you will clip, join, or merge another dataset to the user's data.


For more training on inputting source datasets to workspaces through parameters, please see the Input Source Data at Runtime lesson in Manage FME Flow Data and Connections.
If you have the user input geometry through a spatial Define Geometry parameter, the easiest method to transform the GeoJSON or XML into a geometric feature is to use a GeometryReplacer.


For more training on creating the Define Geometry parameter to use on FME Flow, please see the Get Geometry Input from Users lesson in Build Self-Serve Workflows with Parameters.
Define Geometry Parameter Interactive Web Map
When you run a workspace with a Define Geometry parameter, the parameter enables an interactive web map in FME Flow that lets you draw a point, line, or area of interest to input into the workspace. The map icon next to the parameter opens the interactive web map.

From the web map, you can only input the geometry types set up in the user parameter in the workspace, which you select from the top, then draw or choose the location on the map.

You may collapse the pop-up map by clicking
and expand the menu in the inline map
for the option to pop it out into its own window.


For more information on the Define Geometry parameter and setting custom basemaps for the web map in FME Flow, please see Using the Geometry Parameter.
Exercise

Jennifer, a GIS Specialist, wants to give transit data to colleagues who only ever need one neighborhood at a time. Her workspace already lets the app user pick layers, an output format, and a coordinate system, but it always returns the whole city. She needs a spatial geometry parameter that lets the app user draw the area they need data for.
In this exercise, you will:
- Create a Define Geometry user parameter and link it to a GeometryReplacer.
- Test the workspace, publish it, and build an app that clips output to an area the user draws.
1) Open the Starting Workspace
The workspace begins by creating geometry and reprojecting it. The FeatureReader reads in the transit data from Transit.gdb, then a Clipper clips it to the input geometry. If the output format is OGC KML, the workspace styles each feature type before writing it to the file.

2) Inspect the Existing Parameters
- In the Navigator, right-click User Parameters and select Manage User Parameters.
- The workspace already has three user parameters: the layers to download from the transit data, the output data format, and the output coordinate system.

3) Create the Geometry Parameter
- Click the green + icon and select Spatial to Define Geometry.
- Configure the following parameters:
- Parameter Identifier:
GEOM
- Label:
Area of Interest
- Required: Selected
- Show Label: Selected
- Visibility: Always Show
- Geometry Encoding: GeoJSON
- Geometry Types: Polygon, Box
- Specify initial bounds for map display: Selected
- Top:
49.2548
- Left:
-123.244
- Bottom:
49.3034
- Right:
-123.071
- These bounds frame Vancouver, BC, which is where the transit data is.
- Value Assignment > Hide Parameter Menu Button: Selected

- On the left panel, reorder the parameters so Area of Interest is second, after Layers to Download.
- Click OK to close the User Parameter Manager.
4) Link the Geometry Parameter
- Double-click the GeometryReplacer transformer.
- From the Geometry Source drop-down, select the GEOM parameter under User Parameters.

5) Run the Workspace
- Click Run in the top toolbar.
- FME prompts you to configure the four user parameters.
- For Layers to Download, select one or multiple layers.
- For the Area of Interest, paste the following JSON into the parameter:
{"type":"Polygon","coordinates":[[[-123.116202,49.275826],[-123.116202,49.280585],[-123.10479,49.280585],[-123.10479,49.275826],[-123.116202,49.275826]]]}
- Set the Output Format to Esri Shapefile, and Output Coordinate System to WGS84 Lat/Longs [LL-WGS84].
- Deselect the Save As Parameter Default Values option, then click Run.
- This leaves the default parameter values blank for the end user in the app.

- Optional: Inspect the output in C:\FMEData\Output and confirm the correct layers were written in the correct format.
6) Publish to FME Flow
- Publish the workspace as TransitDataDistribution.fmw to the Training repository.
- Register it with the Data Download, Data Streaming, and Job Submitter services.
Publish to FME Flow
After you build your workflows in FME Workbench, transfer them to FME Flow through the publishing process. To publish a workspace to FME Flow, complete all steps in the publishing wizard.
1. Click Publish in the FME Flow Connection toolbar. The publishing wizard window will open.
2. Confirm your FME Flow Connection lists the correct connection and successfully connects to your FME Flow.
3. Select a repository to house the workspace on FME Flow from the drop-down options. To create a new repository, click New and enter its details.
4. Optionally, you may Upload data files to publish the workspace's source data files to FME Flow along with the workspace. You can control which files to upload from the Select Files... option.
5. Click Next to move on to the next step.
6. If your workspace uses any connections, the Upload Connections section will appear. You can select whether to publish the connections to FME Flow.
7. Register Services is the last publishing step. Select the transformation services you want your workspace to be able to use on FME Flow.
8. Click Publish.
9. The translation log generates a summary of publishing and provides a direct link to open the workspace on FME Flow.
7) Create the Workspace App
- Navigate to FME Flow.
- Open Flow Apps, select the Workspace Apps tab, and click Create.
- Enter a Name, a Title, and a Description, then configure the following parameters:
- Repository: Training
- Workspace: TransitDataDistribution.fmw
- Service: Data Download

- Expand Parameter Defaults and confirm all four parameters are listed, including the new Area of Interest parameter.
- Leave all other settings at their default value and click Create.


8) Run the Workspace App
- Click View App to open it.
- Select the transit layers you want to download.
- Click the map icon to open the Area of Interest interactive web map.

- Click the rectangle or polygon icon, then click on the map to draw the area, then click Confirm.
- FME adds the geometry area as GeoJSON to the parameter input.

- Select an Output Format and Output Coordinate System, then click Run.

- Click the Data Download URL to download the data.

- Use FME Data Inspector to confirm the data covers only the area you drew, in the layers and coordinate system you chose.

You have successfully built another self-serve web app, adding the ability to clip output data to a specific area of interest by linking user-input geometry to the workspace.